﻿using System.Reflection;

namespace Mbs.Reflection
{
    public delegate void Setter(object target, object value);

    public static class FieldSetterExtensions
    {
        public static void Set(this FieldInfo field, object target, object value)
        {
            DynamicMethodFactoryProxy.Instance.CreateSetter(field)(target,value);
        }
    }

    public static class PropertySetterExtensions
    {
        public static void Set(this PropertyInfo property, object target, object value)
        {
            DynamicMethodFactoryProxy.Instance.CreateSetter(property)(target,value);
        }
    }
}
